var g = Graphics.createArrayBuffer(32,32,8);
g.dump = _=>{
  var s = "";
  var b = new Uint8Array(g.buffer);
  var n = 0;
  for (var y=0;y<g.getHeight();y++) {
    s+="\n";
    for (var x=0;x<g.getWidth();x++) 
      s+=".#XO+"[b[n++]];
  }
  return s;
}
g.print = _=>{
  print("`"+g.dump()+"`");
}
var ok = true;
function SHOULD_BE(a) {
  var b = g.dump();
  if (a!=b) {
    console.log("GOT :"+b+"\nSHOULD BE:"+a+"\n================");
    ok = false;
  }
}

g.clear();
g.setColor(1);
g.drawCircle(16,16,10);
g.drawCircle(24,24,6);
g.floodFill(2,2,4);
g.floodFill(21,21,3);
SHOULD_BE(`
++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++
+++++++++++++#######++++++++++++
+++++++++++##.......##++++++++++
++++++++++#...........#+++++++++
+++++++++#.............#++++++++
++++++++#...............#+++++++
+++++++#.................#++++++
+++++++#.................#++++++
++++++#...................#+++++
++++++#...................#+++++
++++++#...................#+++++
++++++#...................#+++++
++++++#...................#+++++
++++++#...............#####+++++
++++++#..............#OOOO##++++
+++++++#............#OOOO#..#+++
+++++++#...........#OOOOO#...#++
++++++++#.........#OOOOO#.....#+
+++++++++#........#OOOO#......#+
++++++++++#.......#OOO#.......#+
+++++++++++##.....#O##........#+
+++++++++++++#######..........#+
+++++++++++++++++++#.........#++
++++++++++++++++++++#.......#+++
+++++++++++++++++++++#.....#++++
++++++++++++++++++++++#####+++++
++++++++++++++++++++++++++++++++`);


result = ok;
